package xyz.syyrjx.blog.controller.admin;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.servlet.ModelAndView;
import xyz.syyrjx.blog.entity.Result;
import xyz.syyrjx.blog.service.AiService;
import xyz.syyrjx.blog.util.CachePool;

import javax.annotation.Resource;

/**
 * @author 大地崩坏苍蝇兽
 * @date 2024/2/20 18:46
 * @description ...
 * @since v0.0.1
 */
@Controller
@RequestMapping("/admin")
public class AiAdminController {

    @Resource
    private AiService aiService;

    @RequestMapping("/aiSetting")
    public ModelAndView aiSettingPage(ModelAndView mv) {
        mv.setViewName("/admin/aiSetting");
        return mv;
    }

    @RequestMapping("/aiSetting/idGradeSetting")
    @ResponseBody
    public Result idGradeSetting(String id, Integer grade) {
        aiService.setAiIdentityGrade(id,grade);
        return Result.success("已设置" + id + "为放行等级" + grade);
    }
}
